#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
	int n = 0; int arr[6][6];
	while (scanf("%d", &n) == 1)
	{
		int i, j; int x, y, a; int flag = 0;
		for (i = 0; i < n; i++)
		{
			for (j = 0; j < n; j++)
			{
				scanf("%d", &arr[i][j]);
			}
		}
		for (i = 0; i < n; i++)
		{
			int k = 0;
			for (j = 0; j < n; j++)
			{
				if (arr[i][j] > k)
				{
					k = arr[i][j]; y = j;
				}
			}
			for (a = 0; a < n; a++)
			{
				if (arr[a][y] < k)
				{
					flag = 1;
				}
			}
			if (flag == 0)
			{
				printf("%d %d\n",i,y); break;
			}
		}
		if (i == n)
		{
			printf("NO\n");
		}


	}

	return 0;
}